#ifdef GL_ES
precision mediump float;
#endif

uniform float startSeq;
uniform float endSeq;
uniform float segments;

varying vec4 vColor;
varying float vSeq;
varying float vSide;

void main() {
    if(vSeq < startSeq || vSeq > endSeq){
        discard;
    }

    float drive_opacity = 1.0;
    drive_opacity = (vSeq - startSeq) / segments;

    vec3 color1 = vColor.rbg + (1.0 - abs(vSide)) * vec3(0.2, 0.2, 0.2);

    gl_FragColor = vec4(color1.rbg, (1.0 - abs(vSide)) * drive_opacity) * vColor.a;
}
